#!/bin/bash
yum -y install vixie-cron
chkconfig -level 35 crond on
rm -rf /bin/cronsh
touch /bin/cronsh
chmod -R 777 /bin/cronsh
read -p "请输入你的监控地址(带上web协议):" no
echo -e "请输入客户端开始压缩时间"
echo -e "依照Crontab的表达式"
echo -e "不懂请百度 Google Bing" 
echo -e "举个栗子"
echo -e "30 2 * * * 每天凌晨2:30执行备份"
echo -e "0 2 * * 1 每周一凌晨2:00执行备份"
echo -e "*/60 * * * *  每小时执行备份"
read time_u
if [ ! -n "$time_u" ];then
	echo "Error:输入为空 请重新运行脚本"
	exit
fi
echo "#!/bin/bash
export uptime=$(date +%F)
wget ${no} -O cronlog
rm -rf cronlog
if [ ! -f "/data/cron-log" ];then
	touch cron-log
	echo "${uptime} Monitored" >> cron-log
else
	echo "${uptime} Monitored" >> cron-log
fi" >> /bin/cronsh
echo "$time_u root /bin/cronsh" >> /etc/crontab
echo -e "\033[32m 任务已提交\033[0m"